package com.example.admin.goodnews.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.util.Pools;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import com.example.admin.goodnews.entity.NewsClassEntity;
import com.example.admin.goodnews.fragment.BaseFragment;

import java.util.List;

/**
 * 主页ViewPager的适配器
 * Created by admin on 2016/9/29.
 */

public class FragmentAdapter extends FragmentStatePagerAdapter {
    private List<String> titlelists;
    private List<Fragment> fragmentlists;

    public FragmentAdapter(FragmentManager fm, List<String> titlelists, List<Fragment> fragmentlists) {
        super(fm);
        this.titlelists = titlelists;
        this.fragmentlists = fragmentlists;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentlists.get(position);
    }

    @Override
    public int getCount() {
        return fragmentlists.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titlelists.get(position);
    }
}
